<?php
namespace app\index\controller;
use think\Controller;
use think\Db;

class Index extends Controller
{
    public function index()
    {
    	$map['status'] = 1;
    	$map['isdelete'] = 0;
    	$desc = Db::name('addr')->where($map)->find();

    	$lunbo = Db::name('lunbo')->where($map)->select();

    	$server = Db::name('server')->where($map)->select();

        $client = Db::name('client')->where($map)->select();
        
        $case = Db::name('casee')->where($map)->select();

        $wenti = Db::name('wenti')->order('id DESC')->limit(4)->select();
        $this->assign('wenti',$wenti);
        
        $this->assign('case',$case);
        $this->assign('server',$server);
    	$this->assign('client',$client);
    	$this->assign('addr',$desc);
    	$this->assign('lunbo',$lunbo);
        return view();
    }


    public function case()
    {
        $map['status'] = 1;
        $map['isdelete'] = 0;

        $map1['status'] = 1;
        $map1['isdelete'] = 0;

        if(input('get.type')){
            $map1['type'] = input('get.type');
        }

        //预留条件
        $case = Db::name('casee')->where($map1)->select();


        $server = Db::name('server')->where($map)->select();
        $this->assign('server',$server);
        $desc = Db::name('addr')->where($map)->find();
        $this->assign('addr',$desc);
        $this->assign('case',$case);
        $wenti = Db::name('wenti')->order('id DESC')->limit(4)->select();
        $this->assign('wenti',$wenti);
        return view();

    }

    public function about()
    {
        $map['status'] = 1;
        $map['isdelete'] = 0;
        $desc = Db::name('addr')->where($map)->find();
        $server = Db::name('server')->where($map)->select();
        $this->assign('server',$server);
        $this->assign('addr',$desc);
        $wenti = Db::name('wenti')->order('id DESC')->limit(4)->select();
        $this->assign('wenti',$wenti);
        return view();
    }

    public function wenti()
    {
        $map['status'] = 1;
        $map['isdelete'] = 0;
        $desc = Db::name('addr')->where($map)->find();
        $data = Db::name('wenti')->where($map)->order('id DESC')->select();
        $server = Db::name('server')->where($map)->select();
        $this->assign('server',$server);
        $this->assign('data',$data);
        $this->assign('addr',$desc);
        $wenti = Db::name('wenti')->order('id DESC')->limit(4)->select();
        $this->assign('wenti',$wenti);
        return view();
    }

    public function wentidesc()
    {
        $id = input('get.id');
        $map['status'] = 1;
        $map['isdelete'] = 0;
        $desc = Db::name('addr')->where($map)->find();
        $this->assign('addr',$desc);
        $data = Db::name('wenti')->where('id',$id)->find();
        $this->assign('data',$data);
        $server = Db::name('server')->where($map)->select();
        $this->assign('server',$server);
        $wenti = Db::name('wenti')->order('id DESC')->limit(4)->select();
        $this->assign('wenti',$wenti);
        return view();
    }

    public function caseeshow()
    {
        $map['status'] = 1;
        $map['isdelete'] = 0;
        $id = input('get.id');
        
        $desc = Db::name('addr')->where($map)->find();
        $this->assign('addr',$desc);
        
        $data = Db::name('casee')->where('id',$id)->find();
        $this->assign('content',htmlspecialchars_decode($data['content']));
        $this->assign('data',$data);
        $server = Db::name('server')->where($map)->select();
        $this->assign('server',$server);
        $wenti = Db::name('wenti')->order('id DESC')->limit(4)->select();
        $this->assign('wenti',$wenti);
        return view();
    }


    public function contact()
    {
        $map['status'] = 1;
        $map['isdelete'] = 0;
        $desc = Db::name('addr')->where($map)->find();
        $this->assign('addr',$desc);
        $server = Db::name('server')->where($map)->select();
        $this->assign('server',$server);
        $wenti = Db::name('wenti')->order('id DESC')->limit(4)->select();
        $this->assign('wenti',$wenti);
        return view();
    }

    public function serverlist()
    {
        $map['status'] = 1;
        $map['isdelete'] = 0;
        $desc = Db::name('addr')->where($map)->find();
        $this->assign('addr',$desc);
        $server = Db::name('server')->where($map)->select();
        $this->assign('server',$server);
        $wenti = Db::name('wenti')->order('id DESC')->limit(4)->select();
        $this->assign('wenti',$wenti);
        return view();
    }
}
